<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta name="Keywords" content="用户注册"/>
    <meta name="Description" content="免费注册，加入<?php echo $config['cfg_webname']; ?>"/>
    <title>用户注册 - <?php echo $config['cfg_webname']; ?></title>
    <link rel="stylesheet" href="__THEME_PATH__css/style.css" type="text/css"/>
    <link rel="stylesheet" href="__THEME_PATH__css/top.css" type="text/css"/>
    <link rel="stylesheet" href="__THEME_PATH__css/reg.css" type="text/css"/>
</head>
<body>
<div align="center">
    <include file="Template/default/header.php"/>
    <script language="javascript" src="__THEME_PATH__/js/m.js"></script>
    <script language="javascript" src="__THEME_PATH__/js/search.js"></script>
    <script type="text/javascript" src="__THEME_PATH__/js/jquery.js"></script>
    <script type="text/javascript" src="__THEME_PATH__/js/lrtk.js"></script>
    <script type="text/javascript">fWeather("4", "500", "32");</script>
    <script type="text/javascript">
        (function () {
            var mini_menu = $('#searchSort');
            mini_menu.click(function (event) {
                mini_menu.next().toggle();
                $('body').one('click', function (event) {
                    //console.log('test');
                    mini_menu.next().hide();
                });
                return false;
            });
        })();
    </script>
    <div class="main">
        <div class="main_part" align="left">
            <div class="regTitle">
                <h2>用户注册</h2>
                我已有账号，<a href="/login/">[直接登录]</a>
            </div>
            <form action="{:U('user/index/reg')}" method="post" name="regForm" id="regForm">
                <table width="800" border="0" class="reg_table" cellspacing="0" cellpadding="0">
                    <tr>
                        <td class="reg_table_title" width="100">用户名：</td>
                        <td width="240"><input type="text" class="inputTextBox" id="UserName" name="UserName"
                                               onblur="checkusername()"/></td>
                        <td class="ps">
                            <div id="UserNamePs">2-16位，汉字、字母、数字、下划线</div>
                        </td>
                    </tr>
                    <tr>
                        <td class="reg_table_title">密码：</td>
                        <td><input type="password" class="inputTextBox" id="PassWord" name="PassWord"
                                   onblur="check_password()"/></td>
                        <td class="ps">
                            <div id="passWordPs">请输入6-16位密码</div>
                        </td>
                    </tr>
                    <tr>
                        <td class="reg_table_title">确认密码：</td>
                        <td><input type="password" class="inputTextBox" id="PassWord1" name="PassWord1"
                                   onblur="check_password1()"/></td>
                        <td class="ps">
                            <div id="passWord1Ps">请再输入一遍密码,以防错误</div>
                        </td>
                    </tr>
                    <tr>
                        <td class="reg_table_title">验证码：</td>
                        <td><input type="text" class="inputTextBox" style="width:70px;" name="Validate"/><img
                                src="{$config['cfg_basehost']}/user/validateCode/" alt="点击更换图片"
                                onclick="this.src='{$config['cfg_basehost']}/user/validateCode/'+Math.random()" style="cursor:pointer"/></td>
                        <td></td>
                    </tr>
                    <tr>
                        <td class="reg_table_title"></td>
                        <td><input id="Submit1" value="" class="reg_button" type="submit"/></td>
                        <td>&nbsp;</td>
                    </tr>
                </table>
            </form>
            <div class="right"><img src="__THEME_PATH__images/br01.png" width="205" height="196" alt="用户注册"/></div>
            <div class="clear"></div>
        </div>
    </div>
    <include file="Template/default/footer.php"/>
</div>
<script type="text/javascript">
    function check_password() {
        var password = document.regForm.PassWord.value;
        if (password.length < 6 || password.length > 16 || password.length == 0) {
            document.getElementById("passWordPs").className = "error_text";
            document.getElementById("passWordPs").innerHTML = "请输入6-16位密码";
        }
        else {
            document.getElementById("passWordPs").className = "right_text";
            document.getElementById("passWordPs").innerHTML = "输入正确";
        }
    }
    function check_password1() {
        var password = document.regForm.PassWord.value;
        var password1 = document.regForm.PassWord1.value;
        if (password != password1) {
            document.getElementById("passWord1Ps").className = "error_text";
            document.getElementById("passWord1Ps").innerHTML = "两次密码不相同";
        }
        else {
            document.getElementById("passWord1Ps").className = "right_text";
            document.getElementById("passWord1Ps").innerHTML = "输入正确";
        }

    }
    function checkusername() {
        var user_name_value = document.regForm.UserName.value;
        if (!/^[a-zA-Z0-9\u4e00-\u9fa5_]{2,16}$/.test(user_name_value)) {
            document.getElementById("UserNamePs").className = "error_text";
            document.getElementById("UserNamePs").innerHTML = "请输入汉字、字母、数字、下划线";
        }
        else {
            var xmlhttp;
            if (window.XMLHttpRequest) {      // code for IE7+, Firefox, Chrome, Opera, Safari
                xmlhttp = new XMLHttpRequest();
            }
            else {      // code for IE6, IE5
                xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
            }
            xmlhttp.onreadystatechange = function () {
                if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
                    document.getElementById("UserNamePs").className = "";
                    document.getElementById("UserNamePs").innerHTML = xmlhttp.responseText;
                }
            }
            var getUrl = '{:U('user/index/checkUserName',array('name'=>'___'),true)}';
            getUrl = getUrl.replace("___",user_name_value);
            xmlhttp.open("GET", getUrl, true);
            xmlhttp.send();
        }
    }

    function check_form() {
        var password = document.regForm.PassWord.value;
        if (password.length < 6 || password.length > 16 || password.length == 0) {
            alert("请输入6-16位密码");
            return false;
        }
        var password1 = document.regForm.PassWord1.value;
        if (password != password1) {
            alert("两次密码不相同");
            return false;
        }
        var user_name_value = document.regForm.UserName.value;
        if (!/^[a-zA-Z0-9\u4e00-\u9fa5_]{2,16}$/.test(user_name_value)) {
            alert("请输入汉字、字母、数字、下划线！")
            return false;
        }
        return true;
    }

    if (getCookie("kfRegUserName") != "") {
        document.regForm.UserName.value = decodeURI(escape(getCookie("kfRegUserName")));
        alert(decodeURI(escape(getCookie("kfRegPs"))));
    }
</script>
</body>
</html>

